//
//  AlbumViewController.h
//  OntheRoadV4
//
//  Created by ZhangYanhua on 14/11/21.
//  Copyright (c) 2014年 EricHuang. All rights reserved.
//

#import <AssetsLibrary/AssetsLibrary.h>
#import <Photos/Photos.h>
#import "AlbumPhotoCell.h"
#import "AlbumCoverCell.h"
#import "AlbumSectionHeaderView.h"
#import "ImageAsset.h"
//#import "MWPhotoBrowser.h"
#import "EditVideoViewController.h"
#import "AVCamPreviewManager.h"
#import "AVCamCaptureManager.h"

@protocol AlbumViewControllerDelegate <NSObject>

- (void)didCancelAlbumPickerAnimated:(BOOL)animated;
- (void)didSkipCamera;

- (void)albumViewControllerShowCameraView;

- (void)didFinishPickingImageAssets:(NSArray *)selectedAssets;

- (void)didFinishPickingVideoWithDict:(NSDictionary *)dict;

@end

@interface AlbumViewController : UIViewController <EditVideoViewControllerDelegate> {
}

@property (nonatomic, weak) id<AlbumViewControllerDelegate> delegate;


@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (weak, nonatomic) IBOutlet UIView *albumMaskView;
@property (weak, nonatomic) IBOutlet UITableView *albumTableView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *albumHeightConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *albumTopSpaceConstraint;
@property (strong, nonatomic) IBOutlet UIView *navTitleView;
@property (weak, nonatomic) IBOutlet UILabel *navTitleLabel;
@property (weak, nonatomic) IBOutlet UILabel *navSubTitleLabel;
@property (weak, nonatomic) IBOutlet UIImageView *navDropArrow;
@property (weak, nonatomic) IBOutlet UILabel *navSingleTitleLabel;
@property (strong, nonatomic) IBOutlet UIView *tableBgView;
@property (weak, nonatomic) IBOutlet UILabel *bgTitleLabel;
@property (weak, nonatomic) IBOutlet UILabel *bgSubTitleLabel;
@property (weak, nonatomic) IBOutlet UIImageView *bgVideoIcon;
@property (weak, nonatomic) IBOutlet UILabel *bgVideoLabel;

@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *loadingIndicator;

@property (nonatomic, retain) NSMutableArray  *assetGroups;
@property (nonatomic, retain) NSMutableArray  *libAssets;
@property (nonatomic, assign) AssetsEnumStatus curEnumStatus;
@property (nonatomic, retain) NSMutableArray  *selectedAssets;
@property (nonatomic, assign) NSUInteger      imageCntLimitation;
@property (nonatomic, assign) NSUInteger      didSelectImage;
@property (nonatomic, retain) ALAssetsLibrary *library;



@property (nonatomic, strong) AVCamPreviewManager *previewManager;
@property (nonatomic, strong) AVCamCaptureManager *captureManager;
@property (nonatomic, strong) AVCaptureVideoPreviewLayer *previewLayer;

- (id)initWithMaxImageCnt:(NSInteger)maxCnt forPhotos:(BOOL)forPhotos;
- (void)takeAPicture:(id)assetURL;
- (void)resetCaptureVideoPreviewLayer;
- (void)updateNavBarTitleView;
- (void)hideAlbumTableView;

- (void)doneBtnPressed:(id)sender;

@end
